package com.shqcjd.sinopecdemomobile.ui.adapter;

import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.model.pojo.TreeNode;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by sy on 2019/5/10.
 */

public class TipWizardProgressAdapter extends BaseQuickAdapter<TreeNode,TipWizardProgressAdapter.ViewHolder> {

    private final int currentStepId;
    public TipWizardProgressAdapter(int currentStepId) {
        super(R.layout.item_tipwizard_progress);
        this.currentStepId = currentStepId;
    }
    public TipWizardProgressAdapter(){
        this(0);
    }

    @Override
    protected void convert(TipWizardProgressAdapter.ViewHolder helper, TreeNode item) {
        helper.name.setText(item.name);
        helper.addOnClickListener(R.id.look_btn);
        helper.addOnClickListener(R.id.tv_complete);
        if (item.current.completed) {
            helper.tv_complete.setBackground(ContextCompat.getDrawable(mContext, R.drawable.shape_btn_round_gray));
        } else {
            helper.tv_complete.setBackground(ContextCompat.getDrawable(mContext, R.drawable.shape_btn_round_light_blue));
        }

    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.look_btn)
        TextView look_btn;
        @BindView(R.id.tv_complete)
        TextView tv_complete;
        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }

}
